// AWTScrollbar.h: interface for the AWTScrollbar class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AWTSCROLLBAR_H__C244C3C1_A005_11D2_A446_006097A44215__INCLUDED_)
#define AFX_AWTSCROLLBAR_H__C244C3C1_A005_11D2_A446_006097A44215__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "AWTComponent.h"

class AFX_EXT_CLASS AWTScrollbar : public AWTComponent,
                                   public AWTAdjustable  
{
DECLARE_DYNAMIC(AWTScrollbar)
public:
	AWTScrollbar();
	AWTScrollbar(int orientation);
	AWTScrollbar(int orientation, int value, int visible, int minimum, int maximum);
	virtual ~AWTScrollbar();

	enum {
		HORIZONTAL = 0,
		VERTICAL
	};

	int getOrientation() 
		{return m_orientation;}
	void setOrientation(int orientation);
  int getValue() 
		{return m_value;}
	void setValue(int newValue) 
		{setValues(newValue, m_visibleAmount, m_minimum, m_maximum);}
	int getMinimum() 
		{return m_minimum;}
	void setMinimum(int newMinimum) 
		{setValues(m_value, m_visibleAmount, newMinimum, m_maximum);}
	int getMaximum() 
		{return m_maximum;}
	void setMaximum(int newMaximum) 
		{setValues(m_value, m_visibleAmount, m_minimum, newMaximum);}
	int getVisibleAmount() 
		{return getVisible();}
	int getVisible() 
		{return m_visibleAmount;}
	void setVisibleAmount(int newAmount) 
		{setValues(m_value, newAmount, m_minimum, m_maximum);}
	void setUnitIncrement(int v) 
		{setLineIncrement(v);}
	void setLineIncrement(int v);
	int getUnitIncrement() 
		{return getLineIncrement();}
	int getLineIncrement() 
		{return m_lineIncrement;}
	void setBlockIncrement(int v) 
		{setPageIncrement(v);}
	void setPageIncrement(int v); 
	int getBlockIncrement() 
		{return getPageIncrement();}
	int getPageIncrement() 
		{return m_pageIncrement;}
	void setValues(int value, int visible, int minimum, int maximum); 
	void addAdjustmentListener(AWTAdjustmentListener* l) 
		{m_adjustmentListener = AWTEventMulticaster::add(m_adjustmentListener, l);}
	void removeAdjustmentListener(AWTAdjustmentListener* l) 
		{m_adjustmentListener = AWTEventMulticaster::remove(m_adjustmentListener, l);}
	void processAdjustmentEvent(AWTAdjustmentEvent* e);

	CWnd* createComponent();
	virtual CSize getMinimumSize();
	virtual CSize getPreferredSize();
	virtual AWTAdjustable* getAdjustable()
		{return dynamic_cast<AWTAdjustable*>(this);}

private:
	void construct(int orientation, int value, int visible, int minimum, int maximum)
	{
		m_lineIncrement = 1;
		m_pageIncrement = 10;
		m_adjustmentListener = NULL;
		m_orientation = orientation;
		setValues(value, visible, minimum, maximum);
	}

protected:
	int	m_value;
	int	m_maximum;
	int	m_minimum;
	int	m_visibleAmount;
	int	m_orientation;
	int m_lineIncrement;
  int m_pageIncrement;
  AWTAdjustmentListener* m_adjustmentListener;
};

#endif // !defined(AFX_AWTSCROLLBAR_H__C244C3C1_A005_11D2_A446_006097A44215__INCLUDED_)
